//只要当前页面有ajax发送就会执行，在ajax发送之前会执行
//通过options可以获取到当前发送的ajax的配置项对象
$.ajaxPrefilter(function(options){
    options.url = 'http://ajax.frontend.itheima.net'+ options.url 
    //包含
    if(options.url.indexOf('/my')!=-1){
        options.headers = {
            Authorization:localStorage.getItem('token')
        }
        // options.headers.Authorization = localStorage.getItem('token')
    }
    options.complete = function(res){
        if(res.responseJSON.status == 1 && res.responseJSON.message == '身份认证失败！'){
            localStorage.removeItem('token')
            location.href = '/login.html'
        }
    }
})


// var obj = {}
// obj.name = 'zs'


// var obj = null;
// obj.name = 'zs'


// var obj = null;
// obj = {
//     name:'zs'
// }